{template 'header'}
<div class="main">
  <h2 class="pubtitle"><span>查看信息</span>
    <div class="c"></div>
  </h2>
  <div class="table-form" style="border-right:1px solid #E5E5E5; width:750px;float:left;">
    <div class="inputbox" style="padding:20px 0;">
      <h2 style="font-size:16px;width:560px;float:left;overflow:hidden;">{$res['title']}</h2>
      <span style="line-height:19px" class="aaa">{$res['updatetime']}</span> <span class="aaa">|</span> <span style="line-height:19px;">浏览<b class="red">{$res['hits']}</b>次</span> </div>
    {if $res['catid'] != '3'}
    <div class="inputbox">
      <label class="t">培训方式：</label>
      <span class="f14">{$res['pxfs']}</span> </div>
    <div class="inputbox">
      <label class="t">科&nbsp;目：</label>
      <span class="f14">{$res['object']}</span> </div>
    <div class="inputbox">
      <label class="t">价&nbsp;格：</label>
      <span class="f14">{if $res['price'] != '0.00'}<b class="red">{$res['price']}</b>元{else}面议{/if}</span> </div>
    <div class="inputbox">
      <label class="t">联系人：</label>
      <span class="f14">{$man}</span> </div>
    <div class="inputbox">
      <label class="t">地&nbsp;址：</label>
      <span class="f14">{$addr}</span> </div>
    <div class="inputbox">
      <label class="t">联系电话：</label>
      <span class="f14"><img src="?m=api&c=index&a=toimage&i={$tel}" /></span> </div>
    {if $email}<div class="inputbox">
      <label class="t">电子邮箱：</label>
      <span class="f14"><img src="?m=api&c=index&a=toimage&i={$email}" /></span> </div>{/if}
      <div class="inputbox">
      <label class="t">好评度：</label>
      <span class="f14 f60"><strong>{$res['feedback']}</strong>%</span> </div>
    {/if}
    <div class="inputbox">
      <label class="t">发布人：</label>
      <span class="f14">{$res['username']}</span>(<a href="#"><span style="color:#005AA0">查看发帖记录</span></a>) </div>
    <div class="inputbox" style="border-top:1px solid #E5E5E5; padding-top:20px; margin-top:20px;">
      <p style="line-height: 28px;margin-top: -5px;padding: 0 10px 15px;" class="f14">{$res['content']}<br />
        <?php if($res['thumb']){?>
        <img src="{UPLOAD_URL}{$res['thumb']}" />
        <?php }?>
      </p>
    </div>
    {if $res['allow_comment'] == "1"}
    <div class="inputbox"><!-- //评论开始 -->
      <form action="" method="post" name="myform" id="myform">
        <div class="outer hot" style="border:1px solid #C2C2C2; width:740px;">
          <div class="inner">
            <div class="ht" style="background-color:#F1F1F1">
              <h3 style="color:#555555">发表评论</h3>
            </div>
            <div class="hc">
              <div class="aaa" style="padding:10px;float:left;width:400px;">请自觉遵守互联网相关的政策法规，严禁发布色情、暴力、反动的言论。</div>
              <div style="float:right;padding:10px;width:140px;height:15px;line-height:15px;">评价：
                <div id="stars" style="display:inline"></div>
              </div>
              <div style="clear:both;padding:10px;">
                <textarea style="overflow-y:auto;width:708px;height:88px" name="msg" id="msg"></textarea>
              </div>
              <div style="padding:10px; clear:both;">用户名：{if $_SESSION['login'] == 0}<input type="text" name="username" id="username" class="input" size="14" />密&nbsp;码：<input type="password" name="password" id="password" class="input" size="14" />验证码：<input type="text" name="captcha" id="captcha" class="input" size="10" /><img onclick="javascript:this.src='?m=api&a=captcha&_' + new Date().getTime()" src="?m=api&a=captcha" title="看不清楚？换一张" style="display: inline; vertical-align:middle; cursor:pointer">{else}{$_SESSION['_username']}{/if}
                <input type="checkbox" name="notuser" id="notuser" />
                &nbsp;<label for="notuser">匿名?</label>&nbsp;<input type="submit" name="dosubmit" id="dosubmit" class="btn2" value="发表评论" />
              </div>
            </div>
            <div class="c"></div>
          </div>
        </div>
      </form>
    </div>
    <!-- //评论结束 --> 
    <!-- //最新评论 -->
    <div class="inputbox">
      <div style="border:1px solid #C2C2C2; width:740px;" class="outer hot">
        <div class="inner">
          <div style="background-color:#F1F1F1" class="ht">
            <a name="new_comment"><h3 style="color:#555555">最新评论</h3></a><a class="more" href="javascript:;">进入详细评论页&raquo;</a>
          </div>
          <div class="hc">
            <dl id="comments">
              <div class="c"></div>
            </dl>
            <div class="c"></div>
          </div>
          <div class="c"></div>
        </div>
      </div>
      <!-- //评论列表窗口 --> 
      
    </div>
    <!-- //最新结束-->
    {/if}
  </div>
  <div class="show_recent">
  <div class="show_recent_title"><strong class="f60">最近浏览</strong></div>
    <dl><script type="text/javascript" src="?m=index&c=content&a=get_view_info&n={$res['id']}"></script></dl>
  </div>
</div>
{template 'footer'}
{if $res['allow_comment'] == "1"}
<script type="text/javascript" src="{JS_PATH}jquery.raty.min.js"></script> 
<script type="text/javascript" src="{JS_PATH}formvalidator.js?v=0514"></script> 
<script type="text/javascript">
$(function(){
	$('#stars').raty({path:'{IMG_PATH}jiajiao/raty/',hintList: ['踩', '不咋地', '一般', '很好', '好极了'], start:4});
	$.get("?m=index&c=comment&a=list_comment&id={$res['id']}", function(data){
		$(data).appendTo($('#comments'));
	});
	$.formValidator.initConfig({autotip:false,formid:"myform",onerror:function(msg){ alert(msg);}, 
	onsuccess:function()
	{
		var username = '', 
			password = '',
			captcha  = '', msg, star;
		var notuser = 0;
		var m = document.myform;
		if(m.username){
			username = m.username.value;
		}
		if(m.password){
			password = m.password.value;
		}
		if(m.captcha){
			captcha = m.captcha.value;
		}
		if(m.notuser.checked){
			notuser = 1;
		}
		msg  = $('#msg').val();
		star = $('#stars-score').val();
		$.ajax({
			type: "POST",
			url: "?m=index&c=comment&a=feedback_ajax",
			data: "cid={$res['id']}&username=" + username + '&password=' + password + '&notuser=' + notuser + '&msg=' + msg + '&star=' + star + '&captcha=' + captcha,
			datatype:'json',
			success: function(d){
				d = (new Function('', 'return ' + d))(); //解析json
				if(d.msg == '1'){
					$('#comments').prepend(d.data);
					$('#msg').val('');
				}else if(d.msg == '2'){
					alert('发表速度太快了，喝杯水休息会吧。');
				}else{
					alert('发表失败，帐号或密码不正确或内容不符合规则');
				}
			}
		});
		return false;
	}});
	$('#msg').formValidator().inputValidator({min:1,max:500,onerror:"评论内容不能为空"});
	$('#username').formValidator().inputValidator({min:3,max:20,onerror:"用户名应该为3-20位之间，数字字母下划线组成。"});
	$("#password").formValidator().inputValidator({min:3,max:20,onerror:"密码应该为3-16位之间"});
	$('#captcha').formValidator().inputValidator({min:4, max:4, onerror:'验证码输入不正确'});
});
</script>
{/if}